﻿
cloud_gaming_model =
{
    uin = 0;
    cloud_gaming_guide_local_cfg_key = "cloud_gaming.entry_new_guide";
    server_record_item = "31";
    server_record_sub_item = "CloudGameNewGuide";
    guide_has_shown = nil;

    cur_focus_game_id = nil;
    show_entry_game_id = nil;

    init = function()
    end;

    inner_log = function (msg, core_msg)
        base_utility.log(string.format("[cloud_gaming_model] %s", msg), core_msg);
    end;

    get_local_cloud_gaming_guide_cfg = function ()
        local data = {};
        data["common"] = 0;
        data["key"] = cloud_gaming_model.cloud_gaming_guide_local_cfg_key;
        local config = comm_center.call_service("Svr_GetConfig", data);
        return config;
    end;

    set_local_cloud_gaming_guide_cfg = function ()
        local data = {};
        data["common"] = 0;
        data["key"] = cloud_gaming_model.cloud_gaming_guide_local_cfg_key;
        local config_tb = {};
        config_tb["is_show"] = "1";
        data["value"] = base_utility.table_to_json(config_tb);
        comm_center.call_service("Svr_SetConfig", data);
    end;

    set_server_cloud_gaming_guide_cfg = function ()
        cloud_gaming_model.inner_log("set_server_cloud_gaming_guide_cfg");
        base_utility.set_accumulate_count(cloud_gaming_model.server_record_item,
                cloud_gaming_model.server_record_sub_item, 1, tostring(cloud_gaming_model.uin), 
                "cloud_gaming_model.on_set_server_cloud_gaming_guide_cfg");

        cloud_gaming_model.set_local_cloud_gaming_guide_cfg();
    end;

    on_set_server_cloud_gaming_guide_cfg = function (json_str)
        cloud_gaming_model.inner_log("on_set_server_cloud_gaming_guide_cfg : "..json_str);
        local result_tb = base_utility.json_to_table(json_str);
        if nil == result_tb then
            return;
        end

        if 0 == result_tb.result then
            cloud_gaming_model.inner_log("set server success");
        end
    end;
};

cloud_gaming_model.init();